﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Business_Detail.ascx.cs"
    Inherits="main_UserControls_Business_Detail" %>
<%@ Register TagPrefix="uc" Namespace="UI.UserControl" Assembly="UI.UserControl" %>
<fieldset class="dsadq">
    <a name="商机报备明细"><legend style="color: #333;"><strong>商机报备明细</strong></legend></a>
    <uc:SimpleResultDataGrid ID="dgmeisai" width="100%" runat="server" ShowFooter="False"
        ShowHeader="true" bhorizontalalign="Center" AutoGenerateColumns="false" ClmStartIndex="0"
        OnItemDataBound="dgmeisai_ItemDataBound">
        <HeaderStyle CssClass="srnr2" Font-Bold="true" HorizontalAlign="Center" />
        <ItemStyle Width="60px" HorizontalAlign="Center" />
        <Columns>
            <asp:TemplateColumn HeaderText="操作">
                <HeaderStyle Width="100px" />
                <ItemStyle Width="100px" />
                <ItemTemplate>
                    <asp:LinkButton ID="btnModify" class="" runat="server" Visible="true"  OnClientClick="modifyDetail()"
                        OnClick="btnModify_Click">
                        <asp:Label ID="Label1" runat="server" Text="修改" CssClass="" /></asp:LinkButton>
                    <asp:LinkButton ID="btnDelete" class="" runat="server" Visible="true"
                        OnClientClick=" return deleteDetail()" OnClick="btnDelete_Click">
                        <asp:Label ID="Label2" runat="server" Text="删除" CssClass="" /></asp:LinkButton>
                    <asp:HiddenField runat="server" ID="hidValueId" Value='<%# DataBinder.Eval(Container, "DataItem.ID") %>' />
                </ItemTemplate>
            </asp:TemplateColumn>
        </Columns>
    </uc:SimpleResultDataGrid>
     <div id ="div_Business_Detail" runat="server"  style="width: 800px; height: 200px; position: absolute; top: 600px;
        left: 124px; display: none; z-index: 1; border:  0px solid; ">
         <fieldset class="dsadq" style="padding-top:0px;"><legend style="color:#434449"><span id="page_title" runat="server">商机报备明细</span></legend>
    <table width="100%" width="200px"  border="0" cellpadding="3" cellspacing="0" style="border-bottom: none;">
        <tr>
                <td width="16%" align="right" valign="middle">
			         <asp:Label runat="server" ID="lbl_PRODUCT_ID__PRODUCT_NAME" Text="产品："></asp:Label>
		        </td>
                    <td height="20" align="left">               
                       
                          <asp:DropDownList ID="ddl_PRODUCT_ID__PRODUCT_NAME" runat="server" CanZhao="PRODUCT_NAME"
                            TiaoJian="DEL_FLG|0|3" dataType="Require" msg="不能为空" CssClass="saae">
                        </asp:DropDownList>
                        <asp:Label runat="server" ID="err_PRODUCT_ID__PRODUCT_NAME"></asp:Label>
                    </td>
                     <td width="16%" align="right" >
			         <asp:Label runat="server" ID="lbl_AMOUNT" Text="数量："></asp:Label>
		        </td>
                    <td height="20" align="left">               
                        <asp:TextBox runat="server" ID="txt_AMOUNT" dataType="Require" msg="不能为空!"
                            CssClass="srjks" Width="60px" MaxLength="10"></asp:TextBox>
                        <asp:Label runat="server" ID="err_AMOUNT"></asp:Label>
                    </td>
            </tr>
            
            <tr> 
                     <td width="16%" align="right" valign="middle">
			           <asp:Label runat="server" ID="lbl_PRICE" Text="单价："></asp:Label>
		        </td>
                      <td height="20" align="left">             
                        <asp:TextBox runat="server" ID="txt_PRICE"  
                            CssClass="srjks"  Width="60px" MaxLength="10"></asp:TextBox>
                        <asp:Label runat="server" ID="err_PRICE"></asp:Label>
                    </td>  
                     <td width="16%" align="right">
			           <asp:Label runat="server" ID="lbl_PRICE2" Text="建议执行单价："></asp:Label>
		        </td>
                      <td height="20" align="left">
                      
                        <asp:TextBox runat="server" ID="txt_PRICE2"  
                            CssClass="srjks"  Width="60px" MaxLength="10"></asp:TextBox>
                        <asp:Label runat="server" ID="err_PRICE2"></asp:Label>
                    </td>   
            </tr>
            <tr>
                <td width="16%" align="right">
			       <asp:Label runat="server" ID="lbl_MEMO" Text="产品特殊要求描述："></asp:Label>
		        </td>
                  <td height="20" align="left" colspan="3">               
                    <asp:TextBox runat="server" ID="txt_MEMO" cols="60" rows="6" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" 
                TextMode="MultiLine" Width="488px"></asp:TextBox>
                    <asp:Label runat="server" ID="err_MEMO"></asp:Label>
                    <asp:Label runat="server" ID="lbl_message" ForeColor="red"></asp:Label>
                </td>  
        </tr> 
        
        <tr>
         <td colspan="5" align="center"  valign="middle">
              <asp:Button runat="server" ID="btnSave" Text="保存" CssClass="seaal"
                    OnClientClick=" return checkDate()" OnClick="btnSave_Click" />
              <asp:Button runat="server" ID="Button1" Text="取消" CssClass="seaal"
                    OnClientClick=" return modifyCancle()"/>
             </td>
        </tr>
            
    </table>
    </fieldset>
  </div>
  <div style="display:none">
  <asp:Button runat="server" ID="btnAdd" Text="添加联系方式"   OnClick="btnAdd_Click"/>
  </div>
    <asp:HiddenField runat="server" ID ="hidBindFlag" value="0"/>
</fieldset>

<script type="text/javascript">
	//其他联系方式数据检查
		function checkDate() {
            //清除空格	
            TrimAllitems();
            //清空错误消息
            this.ClearErrMsg();
            
             var thisForm = document.forms[0];
           var title =document .getElementById ("uc_Business_Detail_ddl_PRODUCT_ID__PRODUCT_NAME");
           var content =document .getElementById ("uc_Business_Detail_txt_AMOUNT");
        
           if (title.value=="")
           {                      
            
                 showErrMsg(document.getElementById("uc_Business_Detail_ddl_PRODUCT_ID__PRODUCT_NAME"), "不能为空！");
                    thisForm.uc_Business_Detail_ddl_PRODUCT_ID__PRODUCT_NAME.focus();
                    return false;
           }
           else if (content.value=="")
           {
             showErrMsg(document.getElementById("uc_Business_Detail_txt_AMOUNT"), "不能为空！");
                    thisForm.uc_Business_Detail_txt_AMOUNT.focus();
                    return false;
           }

           //数量
           var txt_AMOUNT = document.getElementById("uc_Business_Detail_txt_AMOUNT");
           if (txt_AMOUNT.value != "") {
               var reg = /^\d+$/;
               var chk_total = reg.test(txt_AMOUNT.value);
               if (!chk_total) {
                   showErrMsg(txt_AMOUNT, "格式不正确！");
                   return false;
               }
           }

           //单价
           var txt_PRICE = document.getElementById("uc_Business_Detail_txt_PRICE");
           if (txt_PRICE.value != "") {
               var reg = /^[-\+]?\d+(\.\d+)?$/;
               var chk_total = reg.test(txt_PRICE.value);
               if (!chk_total) {
                   showErrMsg(txt_PRICE, "格式不正确！");
                   return false;
               }
           }

           //建议执行单价
           var txt_PRICE2 = document.getElementById("uc_Business_Detail_txt_PRICE2");
           if (txt_PRICE2.value != "") {
               var reg = /^[-\+]?\d+(\.\d+)?$/;
               var chk_total = reg.test(txt_PRICE2.value);
               if (!chk_total) {
                   showErrMsg(txt_PRICE2, "格式不正确！");
                   return false;
               }
           }
           
           
           document.getElementById("uc_Business_Detail_hidBindFlag").value ="0";                     
            return true ;

        }   
        
        
        function deleteDetail()
        {
            
          if( confirm('确定要删除吗？'))
          {
             // document.getElementById("uc_Business_Detail_div_Business_Detail").value = "1";
            return true ;
          }
          return false ;
      }   
        
        
        function modifyDetail() {
           // var hidDiv = document.getElementById("uc_Business_Detail_div_Business_Detail");
          //  hidDiv.style.display = "block"
          //  document.getElementById("uc_Business_Detail_div_Business_Detail").value = "1";
            return false;
        }

        function modifyCancle() {
            var hidDiv = document.getElementById("uc_Business_Detail_div_Business_Detail");
            hidDiv.style.display = "none"
            return false;
        }

        function addDetail() {
            document.getElementById("uc_Business_Detail_btnAdd").click();
            return false;
        } 
</script>

